<?php

namespace App\Services\Config;

use App\Repositories\Config\GameItemRepository;
use Cache;

class GameItemService
{
    public function __construct(GameItemRepository $gameItemRepository)
    {
        $this->gameItemRepository = $gameItemRepository;
    }

    //获取当前游戏的物品表
    public function getGameItems()
    {
        $condition = [
            'game_id' => session('game_id'),
        ];

        $items = $this->gameItemRepository->getByCondition($condition);

        return $items;

//        $items_html = '';
//        foreach ($items as $item) {
//            $items_html .= "<option value=\"{$item->item_key}\" hassubinfo=\"true\">{$item->item_name}({$item->item_key})</option>";
//        }
//
//        return $items_html;
    }

}